package day4;

import java.util.Arrays;

public class Test1 {
    public static void main(String[] args) {
        //二维数组
        //定义方式一
        int[][] arr1 = new int[2][3];
        System.out.println(arr1);
        System.out.println(arr1[0]);
        System.out.println(arr1[1]);
        System.out.println(Arrays.toString(arr1));//两个地址值
        System.out.println("===================");

        //定义方式二
        int[][] arr2 = new int[2][];
        System.out.println(arr2);
        System.out.println(arr2[0]);
        System.out.println(arr2[1]);
        System.out.println(Arrays.toString(arr2));//两个地址值
        arr2[0] = new int[2];
        arr2[1] = new int[5];

        //静态初始化
        int[][] arr3 = new int[][]{{1,2},{2},{3,5,6}};
        for (int i = 0; i < arr3.length; i++) {
            for (int j = 0; j < arr3[i].length; j++) {
                System.out.print(arr3[i][j]);
            }
            System.out.println();
        }

    }
}
